package cn.westv.scps.domain;

import java.io.Serializable;
import java.util.Set;

import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;

import org.codehaus.jackson.annotate.JsonIgnore;
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
import org.hibernate.annotations.GenericGenerator;

/**
 * Created by Administrator on 2017/08/09.
 */
@Entity(name = "area_sever")
// @Table(name = "area_sever")
public class AreaSeverEntity implements Serializable {
	private String serverId;
	private String serverName;
	private String contextPath;
	private String areaCode;
	private String proxyId;
	private String proxySecret;
	private String mqttHostIp;
	private String mqttTcpHostPort;
	private String mqttSocketHostPort;
	private String mqttAccount;
	private String mqttPwd;
	private String insuranceSendEmail;
	private String insuranceCcEmail;
	private String needIsurEmail;
	private String done;
	private Set<BikeOwnerEntity> bikeOners;
	private Set<SysMassageSendRecordEntity> sysMassageSendRecordEntitys;
	private Set<PublishAgentEntity> publishAgentEntitys;

	@Id
	@Column(name = "server_id", nullable = false, length = 32)
	@GeneratedValue(generator = "uuid")
	@GenericGenerator(name = "uuid", strategy = "uuid")
	public String getServerId() {
		return serverId;
	}

	public void setServerId(String serverId) {
		this.serverId = serverId;
	}

	@Basic
	@Column(name = "server_name", nullable = true, length = 32)
	public String getServerName() {
		return serverName;
	}

	public void setServerName(String serverName) {
		this.serverName = serverName;
	}

	@Basic
	@Column(name = "context_path", nullable = true, length = 32)
	public String getContextPath() {
		return contextPath;
	}

	public void setContextPath(String contextPath) {
		this.contextPath = contextPath;
	}

	@Basic
	@Column(name = "area_code", nullable = true, length = 18)
	public String getAreaCode() {
		return areaCode;
	}

	public void setAreaCode(String areaCode) {
		this.areaCode = areaCode;
	}

	@Basic
	@Column(name = "proxy_id", nullable = true, length = 64)
	public String getProxyId() {
		return proxyId;
	}

	public void setProxyId(String proxyId) {
		this.proxyId = proxyId;
	}

	@Basic
	@Column(name = "proxy_secret", nullable = true, length = 64)
	public String getProxySecret() {
		return proxySecret;
	}

	public void setProxySecret(String proxySecret) {
		this.proxySecret = proxySecret;
	}

	@Basic
	@Column(name = "mqtt_host_ip", nullable = true, length = 16)
	public String getMqttHostIp() {
		return mqttHostIp;
	}

	public void setMqttHostIp(String mqttHostIp) {
		this.mqttHostIp = mqttHostIp;
	}

	@Basic
	@Column(name = "mqtt_tcp_host_port", nullable = true, length = 8)
	public String getMqttTcpHostPort() {
		return mqttTcpHostPort;
	}

	public void setMqttTcpHostPort(String mqttTcpHostPort) {
		this.mqttTcpHostPort = mqttTcpHostPort;
	}

	@Basic
	@Column(name = "mqtt_socket_host_port", nullable = true, length = 8)
	public String getMqttSocketHostPort() {
		return mqttSocketHostPort;
	}

	public void setMqttSocketHostPort(String mqttSocketHostPort) {
		this.mqttSocketHostPort = mqttSocketHostPort;
	}

	@Basic
	@Column(name = "mqtt_account", nullable = true, length = 32)
	public String getMqttAccount() {
		return mqttAccount;
	}

	public void setMqttAccount(String mqttAccount) {
		this.mqttAccount = mqttAccount;
	}

	@Basic
	@Column(name = "mqtt_pwd", nullable = true, length = 32)
	public String getMqttPwd() {
		return mqttPwd;
	}

	public void setMqttPwd(String mqttPwd) {
		this.mqttPwd = mqttPwd;
	}

	@Basic
	@Column(name = "insurance_send_email", nullable = true, length = 256)
	public String getInsuranceSendEmail() {
		return insuranceSendEmail;
	}

	public void setInsuranceSendEmail(String insuranceSendEmail) {
		this.insuranceSendEmail = insuranceSendEmail;
	}

	@Basic
	@Column(name = "insurance_cc_email", nullable = true, length = 256)
	public String getInsuranceCcEmail() {
		return insuranceCcEmail;
	}

	public void setInsuranceCcEmail(String insuranceCcEmail) {
		this.insuranceCcEmail = insuranceCcEmail;
	}

	@Basic
	@Column(name = "NEED_ISUR_EMAIL", nullable = true, length = 2)
	public String getNeedIsurEmail() {
		return needIsurEmail;
	}

	public void setNeedIsurEmail(String needIsurEmail) {
		this.needIsurEmail = needIsurEmail;
	}

	@OneToMany(cascade = CascadeType.REFRESH, mappedBy = "areaSever")
	@JsonIgnore
	public Set<BikeOwnerEntity> getBikeOners() {
		return bikeOners;
	}

	@JsonIgnore
	public void setBikeOners(Set<BikeOwnerEntity> bikeOners) {
		this.bikeOners = bikeOners;
	}

	
	
	public String getDone() {
		return done;
	}

	public void setDone(String done) {
		this.done = done;
	}

	@ManyToMany(mappedBy = "areaSevers", cascade = CascadeType.REFRESH)
	@JsonIgnore
	public Set<SysMassageSendRecordEntity> getSysMassageSendRecordEntitys() {
		return sysMassageSendRecordEntitys;
	}

	@JsonIgnore
	public void setSysMassageSendRecordEntitys(Set<SysMassageSendRecordEntity> sysMassageSendRecordEntitys) {
		this.sysMassageSendRecordEntitys = sysMassageSendRecordEntitys;
	}

	@OneToMany(cascade = CascadeType.REFRESH, mappedBy = "areaSever")
	@JsonIgnore
	public Set<PublishAgentEntity> getPublishAgentEntitys() {
		return publishAgentEntitys;
	}

	@JsonIgnore
	public void setPublishAgentEntitys(Set<PublishAgentEntity> publishAgentEntitys) {
		this.publishAgentEntitys = publishAgentEntitys;
	}

	@Override
	public boolean equals(Object o) {
		if (this == o)
			return true;
		if (o == null || getClass() != o.getClass())
			return false;

		AreaSeverEntity that = (AreaSeverEntity) o;

		if (serverId != null ? !serverId.equals(that.serverId) : that.serverId != null)
			return false;
		if (serverName != null ? !serverName.equals(that.serverName) : that.serverName != null)
			return false;
		if (contextPath != null ? !contextPath.equals(that.contextPath) : that.contextPath != null)
			return false;
		if (areaCode != null ? !areaCode.equals(that.areaCode) : that.areaCode != null)
			return false;
		if (proxyId != null ? !proxyId.equals(that.proxyId) : that.proxyId != null)
			return false;
		if (proxySecret != null ? !proxySecret.equals(that.proxySecret) : that.proxySecret != null)
			return false;
		if (mqttHostIp != null ? !mqttHostIp.equals(that.mqttHostIp) : that.mqttHostIp != null)
			return false;
		if (mqttTcpHostPort != null ? !mqttTcpHostPort.equals(that.mqttTcpHostPort) : that.mqttTcpHostPort != null)
			return false;
		if (mqttSocketHostPort != null ? !mqttSocketHostPort.equals(that.mqttSocketHostPort)
				: that.mqttSocketHostPort != null)
			return false;
		if (mqttAccount != null ? !mqttAccount.equals(that.mqttAccount) : that.mqttAccount != null)
			return false;
		if (mqttPwd != null ? !mqttPwd.equals(that.mqttPwd) : that.mqttPwd != null)
			return false;
		if (insuranceSendEmail != null ? !insuranceSendEmail.equals(that.insuranceSendEmail)
				: that.insuranceSendEmail != null)
			return false;
		if (insuranceCcEmail != null ? !insuranceCcEmail.equals(that.insuranceCcEmail) : that.insuranceCcEmail != null)
			return false;
		if (needIsurEmail != null ? !needIsurEmail.equals(that.needIsurEmail) : that.needIsurEmail != null)
			return false;

		return true;
	}

	@Override
	public int hashCode() {
		int result = serverId != null ? serverId.hashCode() : 0;
		result = 31 * result + (serverName != null ? serverName.hashCode() : 0);
		result = 31 * result + (contextPath != null ? contextPath.hashCode() : 0);
		result = 31 * result + (areaCode != null ? areaCode.hashCode() : 0);
		result = 31 * result + (proxyId != null ? proxyId.hashCode() : 0);
		result = 31 * result + (proxySecret != null ? proxySecret.hashCode() : 0);
		result = 31 * result + (mqttHostIp != null ? mqttHostIp.hashCode() : 0);
		result = 31 * result + (mqttTcpHostPort != null ? mqttTcpHostPort.hashCode() : 0);
		result = 31 * result + (mqttSocketHostPort != null ? mqttSocketHostPort.hashCode() : 0);
		result = 31 * result + (mqttAccount != null ? mqttAccount.hashCode() : 0);
		result = 31 * result + (mqttPwd != null ? mqttPwd.hashCode() : 0);
		result = 31 * result + (insuranceSendEmail != null ? insuranceSendEmail.hashCode() : 0);
		result = 31 * result + (insuranceCcEmail != null ? insuranceCcEmail.hashCode() : 0);
		result = 31 * result + (needIsurEmail != null ? needIsurEmail.hashCode() : 0);
		return result;
	}
}
